/**
 * 
 */
package com.zoiz.util;

import java.util.Map;


import com.zoiz.dbutils.ThreadHolder;
import com.zoiz.plus.ActionContext;
import com.zoiz.plus.Execution;
import com.zoiz.plus.Interceptor;
import com.zoiz.plus.InterceptorChain;
import com.zoiz.plus.InterceptorOrder;


/**
 * @author administrator
 * 
 */
@InterceptorOrder(10)
public class VelocityPrepareInterceptor implements Interceptor {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.expressme.webwind.Interceptor#intercept(org.expressme.webwind.Execution
	 * , org.expressme.webwind.InterceptorChain)
	 */
	@Override
	public void intercept(Execution execution, InterceptorChain chain)
			throws Exception {
		ActionContext context = ActionContext.getActionContext();
		Map<String, Object> model = ThreadHolder.getHolder().get_model();
		model.put("request", execution.request);
		model.put("session", execution.request.getSession());
		model.put("application", context.getServletContext());
		model.put("date", context.getServletContext().getAttribute("_date"));
		chain.doInterceptor(execution);
	}
}
